<template>
		<uni-card :is-shadow="false" is-full>
		<view class="topText">
			<text class="uni-h6">昵称最多设置16个汉字</text>
		</view>
		<uni-forms ref="userForm" :modelValue="userFormData" :rules="rules">
			<uni-forms-item label="昵称" required name="userName">
				<uni-easyinput v-model="userFormData.userName" placeholder="请输入昵称" />
			</uni-forms-item>
		</uni-forms>

		<!-- <view class="button-com"> -->
			<button type="primary" @click="submit">确认修改</button>
		<!-- </view> -->
		</uni-card>




</template>

<script>
	export default {
		data() {
			return {
				userFormData: {
					userName: '',
					// phone:'',
					// password:''
				},
				rules: {
					userName: {
						rules: [{
							required: true,
							errorMessage: '请输入昵称',
						}]

					}

				}
			}
		},
		onLoad() {},
		onReady() {
			// 设置自定义表单校验规则，必须在节点渲染完毕后执行
			this.$refs.userForm.setRules(this.rules)
		},
		methods: {
			submit() {
				this.$refs['userForm'].validate().then(res => {
					uni.showToast({
						title: `发起请求`
					})
				}).catch(err => {
					console.log('err', err);
				})
			},
			loginOut() {

			}
		}
	}
</script>

<style lang="scss" scoped>
	.topText{
		margin-bottom: 20rpx;
	}
	.button-com {
		text-align: center;
		margin-top: 10rpx;

		.btn {
			width: 80%;
		}
	}
</style>
